/* 
 * File:   Boss.h
 * Author: paula
 *
 * Created on 29 de noviembre de 2014, 15:50
 */

#ifndef BOSS_H
#define	BOSS_H

#include "../Define/DefaultValues.h"
#include <string>
#include "Object.h"
#include "WorldElement.h"
#include "ObjFactory.h"
#include "Dot.h"
#include <chrono>

class Boss : public WorldElement {
public:
    Boss();
    Boss(ObjFactory *objFactory, int x, int y);
    Boss(const Boss& orig);
    virtual ~Boss();

    bool equals;
    void wait();

    void jump();
    void attack();
    void beAttacked();
    //    void die();     // muerte para desconexion
    //    void kill();    // muerte para lifes== 0

    bool isJumping();
    bool isAttacking();
    bool isBeingAttacked();
    bool isFallingDown();
    //
    void keepJumping();
    void keepAttacking();
    void keepAttacked();
    void keepFallingDown();


    //    void stopKneeling();

    int getState();
    float getPosX();
    float getPosY();
    struct ObjectInit getData();
    int getUbicDyn();
    b2Body* getBody();
    bool getAreEquals();
    //    int getScore();
    //    int getLifes();

    void setUbicDyn(int i);

    void updateData();
    //    void updateEvent(struct Event e);

    void checkChanges();

    void beRandom();
    bool inConctactBullet();
    
    bool isAlive();

    //shoot
    //    SnowBall* shoot();
    void restartPlayer();
private:

    struct ObjectInit data;
    Dot *dot;

    bool directionRight;
    bool wasJumping;
    bool beginning;
    bool jumping, attacking, fallingDown, attacked;
    int counterAttack, counterAttacked, counterJump, counterWait;
    float windowPixelWidth, windowPixelHeight, windowUnitWidth, windowUnitHeight;
    float lastPosY, currentPosY, lastVelY, currentVelY;

    int lastState;

    float objWidth, objHeight;
    Object* object;
    ObjFactory *objFactory;
    SBSLog* myLogFile;

    float constFall;
    float initConsFall;

    float posX;
    float posY;
    b2Vec2 posInitial;
    int score;
    int lifes;

    void jumpUp();
    //    void jumpLeft();
    //    void moveRight(float velocityX, float velocityY);
    //    void moveLeft(float velocityX, float velocityY);
    void actualizePosition();

    void updatePosition();
    void updateState();
    void updateRotation();

    //    SnowGun *weapon;

    //    std::chrono::time_point<std::chrono::system_clock> start;
    //    std::chrono::time_point<std::chrono::system_clock> now;
    
    int contSend;

};

#endif	/* BOSS_H */

